Use ::has-subtitle when constructing CSD titlebars
authorMatthias Clasen <mclasen@redhat.com>
Wed, 11 Dec 2013 03:58:57 +0000 (22:58 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Wed, 11 Dec 2013 04:03:12 +0000 (23:03 -0500)
GtkWindow was constructing a custom title label to
avoid the size reservation for a subtitle. This is
now easier with the ::has-subtitle property.

gtk/gtkwindow.c

index 398f1ecb4ddeae1a040586fd36f770e4f687860a..90b832009adc057bdafde2302bebbe16507c85a7 100644 (file)
@@ -5377,31 +5377,19 @@ static GtkWidget *
 create_titlebar (GtkWindow *window)
 {
   GtkWindowPrivate *priv = window->priv;
-  GtkWidget *label;
   GtkWidget *titlebar;
   GtkStyleContext *context;
-  gchar *title;
 
   titlebar = gtk_header_bar_new ();
   g_object_set (titlebar,
                 "spacing", 0,
+                "title", priv->title ? priv->title : get_default_title (),
+                "has-subtitle", FALSE,
                 NULL);
   context = gtk_widget_get_style_context (titlebar);
   gtk_style_context_add_class (context, GTK_STYLE_CLASS_TITLEBAR);
   gtk_style_context_add_class (context, "default-decoration");
 
-  title = g_markup_printf_escaped ("<b>%s</b>",
-                                   priv->title ? priv->title : get_default_title ());
-  label = gtk_label_new (title);
-  g_free (title);
-  g_object_set (label,
-                "use-markup", TRUE,
-                "ellipsize", PANGO_ELLIPSIZE_END,
-                "margin", 6,
-                NULL);
-
-  gtk_header_bar_set_custom_title (GTK_HEADER_BAR (titlebar), label);
-
   return titlebar;
 }